//
//  ViewController.m
//  LableTest
//
//  Created by 刘家俊 on 2017/7/10.
//  Copyright © 2017年 Andrew. All rights reserved.
//

#import "ViewController.h"
#import "YMStringSize.h"
#import "FirstViewController.h"
#import "SecondViewController.h"

@interface ViewController () <UITableViewDelegate,UITableViewDataSource>

/* tableView */
@property (nonatomic, weak) UITableView *tableView;


@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    //tableView
    UITableView *tableView = [[UITableView alloc] initWithFrame:self.view.bounds];
    tableView.delegate = self;
    tableView.dataSource = self;
    [self.view addSubview:tableView];
    self.tableView = tableView;
    
}

#pragma mark - UITableViewDelegate
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 100;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *ID = @"cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
    }
    
    if (indexPath.row == 0) {
        cell.textLabel.text = @"解决标点符号居中问题";
    } else if (indexPath.row == 1) {
        cell.textLabel.text = @"两个string同种颜色不同字号";
    }  else if (indexPath.row == 2) {
        cell.textLabel.text = @"两个string不同颜色不同字号";
    } else if (indexPath.row == 3) {
        cell.textLabel.text = @"两个关键字同颜色同字号";
    } else if (indexPath.row == 4) {
        cell.textLabel.text = @"两个关键字不同颜色不字号";
    }
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 0) {
        FirstViewController *vc = [[FirstViewController alloc] init];
        [self.navigationController pushViewController:vc animated:YES];
    } else {
        [self pushToViewController:indexPath];
    }
}

- (void)pushToViewController:(NSIndexPath *)indexPath
{
    SecondViewController *vc = [[SecondViewController alloc] init];
    vc.indexpath = indexPath;
    [self.navigationController pushViewController:vc animated:YES];
}

@end
